package Math.两道算法水题;

public class 统计一共有多少个水仙花数 {
    public static void main(String[] args) {
        int count = 0;
        for (int i = 100; i <= 999; i++) {
            int ge = i % 10;
            int shi = i / 10 % 10;
            int bai = i / 100 % 10;

            double num = Math.pow(ge, 3) + Math.pow(shi, 3) + Math.pow(bai, 3);

            if (num == i) {
                System.out.println(i);
                count++;
            }
        }
        System.out.println("一共有" + count + "个水仙花数");
    }
}
